﻿namespace Ngs.Data
{
    using System;

    public class Mapper<TSource, TDestination> : IMapper<TSource, TDestination>
    {
        public Mapper()
        {
        }

        public Action<TSource, TDestination> FieldMap { get; set; }

        public virtual void Execute(TSource entity, TDestination obj)
        {
            if (FieldMap != null)
            {
                this.FieldMap(entity, obj);
            }
        }

        void IMapper.Execute(object entity, object obj)
        {
            this.Execute((TSource)entity, (TDestination)obj);
        }

    }
}
